home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 3 / ct-rom iiib.zip / ct-rom iiib / WINDOWS / UTILITY / DESKTOP / W_ONE49 / WOIO.H_ / WOIO.H
C/C++ Source or Header  |  1994-04-27  |  8KB  |  255 lines

  1. /******************************************************************\
  2. *                                                                  *
  3. *           w       w                oooo                           *
  4. *           w       w  iii  n   n   o    o   n   n  eeee            *
  5. *           w       w   i   nn  n  o      o  nn  n  e               *
  6. *           w   w   w   i   n n n  o      o  n n n  eee             *
  7. *              w w w w    i   n  nn   o    o   n  nn  e               *
  8. *              w   w    iii  n   n    oooo    n   n  eeee            *
  9. *                                                                      *
  10. *     C o m m a n d   L a n g u a g e   I n t e r p r e t e r      *
  11. *                                                                      *
  12. *                                                                      *
  13. *    Written by Lucien Cinc                                         *
  14. *    Copyright (c) 1992, 1993                                       *
  15. *                                                                   *
  16. *                                                                   *
  17. *    For a complete description of all the functions in this file   *
  18. *    see the  WOIO.HLP help file. WOIO.HLP is located in the sub-   *
  19. *    directory WOIO, for example :-                                 *
  20. *                                                                  *
  21. *                    C:\WIN_ONE\WOIO\WOIO.HLP                       *
  22. *                                                                  *
  23. *    Note: To view this  file from  WinOne use the  /4 switch for   *
  24. *          command  TYPE,  since  I use  only  4 spaces  for  tab   *
  25. *          characters, for example :-                               *
  26. *                                                                  *
  27. *                    TYPE WOIO.H /4                                 *
  28. *                                                                   *
  29. \******************************************************************/
  30.  
  31. #ifndef __WOIO_H
  32. #define __WOIO_H
  33.  
  34. #include <windows.h>
  35. #include <bwcc.h>
  36.  
  37. /*
  38.     include stdio.h here so that the macros putchar
  39.     and getchar    can be removed!
  40. */
  41.  
  42. #include <stdio.h>
  43. #include <dir.h>
  44.  
  45. #ifdef putchar
  46. #undef putchar
  47. #endif    /* putchar */
  48.  
  49. #ifdef getchar
  50. #undef getchar
  51. #endif    /* getchar */
  52.  
  53. #ifdef __cplusplus
  54. extern "C" {
  55. #endif  /* __cplusplus */
  56.  
  57. #define BLACK            (char )128   /* text colours */
  58. #define    RED             (char )129
  59. #define GREEN            (char )130
  60. #define BLUE            (char )131
  61. #define YELLOW             (char )132
  62. #define MAGENTA            (char )133
  63. #define CYAN            (char )134
  64. #define WHITE            (char )135
  65. #define LIGHTGRAY        (char )136
  66. #define LIGHTRED        (char )137
  67. #define LIGHTGREEN        (char )138
  68. #define LIGHTBLUE        (char )139
  69. #define BROWN            (char )140
  70. #define LIGHTMAGENTA    (char )141
  71. #define LIGHTCYAN        (char )142
  72. #define DARKGRAY        (char )143
  73.  
  74. /*******************************\
  75. *                                *
  76. *        Control Functions        *
  77. *                                *
  78. \*******************************/
  79.  
  80. #define BUFFERED    1        /* screen output */
  81. #define UNBUFFERED    0
  82.  
  83. void screen(int flag);                    /* buffered screen output */
  84. void yield(void);                        /* alow other tasks to multitask */
  85.  
  86. /*******************************\
  87. *                                *
  88. *     Screen Output Functions    *
  89. *                                *
  90. \*******************************/
  91.  
  92. int  printf(const char *fmt, ...);      /* printf formated output */
  93. int  puts(const char *s);                /* string output + CR-LF */
  94. int  putchar(const int c);                /* character output    */
  95. int  putch(int c);                        /* character output    */
  96. void perror(const char *msg);            /* display an error message    */
  97. void textcolor(int col);                /* set the text colour */
  98.  
  99. void clrscr(void);                        /* clear the screen */
  100. void clreol(void);                        /* clear till end of line */
  101. void gotoxy(int x, int y);                /* position cursor on screen */
  102. int  wherex(void);                        /* location of caret (horizontal) */
  103. int  wherey(void);                        /* location of caret (vertical) */
  104.  
  105. int scrwidth(void);                        /* screen width in characters */
  106. int scrheight(void);                    /* screen height in character */
  107.  
  108. char *atoc(char *number);                /* insert comma's into a number */
  109.  
  110. /*******************************\
  111. *                                *
  112. *         Input Functions        *
  113. *                                *
  114. \*******************************/
  115.  
  116. int  scanf(const char *fmt, ...);        /* scanf formated input    */
  117. char *gets(char *s);                    /* get a string    */
  118. int  getchar(void);                        /* get a character */
  119. int  getch(void);                        /* get a character no echo */
  120.  
  121. /*******************************\
  122. *                                *
  123. *     Command Line Functions        *
  124. *                                *
  125. \*******************************/
  126.  
  127. int  argc(void);                        /* number of arguments */
  128. char *argv(int index);                     /* get an argument */
  129. int  argn(void);                        /* number of switches */
  130. char *args(void);                        /* get all switches */
  131.  
  132. char *argpath(int index);                /* get path argument */
  133. char *argabs(int index);                /* get absolute path argument */
  134. char *argtail(void);                    /* get command line tail */
  135. char *argstr(int index);                /* get command line string */
  136. int  argnstr(void);                        /* number of command line strings */
  137. BOOL isargstr(int index);                /* is an argument a string */
  138.  
  139. /*******************************\
  140. *                                *
  141. *       Status Bar Functions        *
  142. *                                *
  143. \*******************************/
  144.  
  145. void limit(unsigned long upper);        /* status bar upper limit */
  146. void inc(unsigned long value);            /* status bar increment by value */
  147. void empty(void);                        /* empty status bar */
  148.  
  149. /*******************************\
  150. *                                *
  151. *  File manipulation Functions    *
  152. *                                *
  153. \*******************************/
  154.  
  155. #define INC_BYTE    0    // u_flag's for status bar updating
  156. #define INC_ONE        1
  157. #define INC_NONE    2
  158.  
  159. #define O_OPEN        0    // o_flag's for opening dest file
  160. #define O_CREATE    1
  161. #define O_CREATNEW  2
  162.  
  163. long filesize(char *path);
  164. long filecpy(char *dst, char *src, int o_flag, int u_flag);
  165. long filecat(char *dst, char *src, int u_flag);
  166.  
  167. long filencpy(char *dst, char *src, long num, long offset, int o_flag, int u_flag);
  168. long filencat(char *dst, char *src, long num, long offset, int u_flag);
  169.  
  170. /*******************************\
  171. *                                *
  172. *       File Name Functions        *
  173. *                                *
  174. \*******************************/
  175.  
  176. #define ATT_RHSDA     (unsigned int )(FA_RDONLY|FA_HIDDEN|FA_SYSTEM|FA_DIREC|FA_ARCH)
  177. #define ATT_RHSA     (unsigned int )(FA_RDONLY|FA_HIDDEN|FA_SYSTEM|FA_ARCH)
  178.  
  179. int fillfile(char *path, unsigned int attr);    /* block file fill */
  180. BOOL getfile(int index, struct ffblk *pff);        /* get file ffblk */
  181. char *getfilepath(int index);                     /* get file path, may not be a fully qualified path */
  182. char *getfilename(int index);                    /* get file name */
  183. char *padfilename(char *path);                  /* pad a filename for displaying */
  184.  
  185. /*******************************\
  186. *                                *
  187. *          Path Functions            *
  188. *                                *
  189. \*******************************/
  190.  
  191. int fillpath(char *path);                /* block path fill */
  192. int fillpathall(void);                    /* block path fill for all drives */
  193. void freepaths(void);                    /* free paths */
  194. char *getpath(int index);                /* get a path */
  195. int totalfiles(void);                    /* total number of files in paths */
  196.  
  197. /*******************************\
  198. *                                *
  199. *   Unix conversion functions   *
  200. *                                *
  201. \*******************************/
  202.  
  203. char *unixpath(char *path);                /* convert dos path to unix */
  204. char *unixcmd(char *cmd);                /* convert dos command to unix */
  205. int isunix(void);                        /* unix mode flag */
  206. char *todospath(char *path);            /* convert unix path to dos */
  207. char *todoscmd(char *cmd);                /* convert unix command to dos */
  208.  
  209. /*******************************\
  210. *                                *
  211. *  File Description Functions    *
  212. *                                *
  213. \*******************************/
  214.  
  215. char *getdesc(char *path);                /* get a file description */
  216. int setdesc(char *path, char *str);        /* set a file description */
  217. int deldesc(char *path);                /* delete a file description */
  218.  
  219. /*******************************\
  220. *                                *
  221. *    Environment Functions        *
  222. *                                *
  223. \*******************************/
  224.  
  225. char *getenvironment(char *name);        /* get WinOne environment variable */
  226. int putenvironment(char *name);            /* set WinOne environment variable */
  227.  
  228. /*******************************\
  229. *                                *
  230. *          System Call            *
  231. *                                *
  232. \*******************************/
  233.  
  234. int _FARFUNC system(const char _FAR * c);
  235.  
  236. /*******************************\
  237. *                                *
  238. *       Global Variables        *
  239. *                                *
  240. \*******************************/
  241.  
  242. HINSTANCE gethinst(void);
  243.  
  244. extern char *arg_v[];            /* argv */
  245. extern int arg_c;                /* argc */
  246. extern int errcnt;                /* perror counter */
  247.  
  248. extern int main(void);    /* program entry point */
  249.  
  250. #ifdef __cplusplus
  251. }
  252. #endif  /* __cplusplus */
  253.  
  254. #endif    /* __WOIO_H */
  255.